//
//  AppDelegate.m
//  BuDeJie
//
//  Created by 仲琦 on 16/3/31.
//  Copyright © 2016年 仲琦. All rights reserved.
//

#import "AppDelegate.h"

#import "ZQADviewControlloer.h"
#import "ZQTabBaController.h"
#import <AFNetworking.h>
@interface AppDelegate ()

@end

@implementation AppDelegate




/**
 *  可以在这个AppDelegate方法中监听到状态栏的点击
 */
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    //点击的位置如果大于状态栏就返回
    if ([touches.anyObject locationInView:nil].y > 20) return;
    
    ZQLog(@"点击了状态栏");
}

/*
 
 在程序启动完成的时候 进入广告界面
 搞一个广告控制器,直接设为窗口的根部控制器
 欺骗用户,让用户感觉一直在启动程序,
 
 */
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    
    //创建窗口 设置窗口尺寸
    
    self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
    
    //创建广告接片.
//    ZQADviewControlloer *ad = [[ZQADviewControlloer alloc]init];
    
    ZQTabBaController *tabBar = [[ZQTabBaController alloc]init];
    
    self.window.rootViewController = tabBar;
    
    
    //添加到窗口
    [self.window makeKeyAndVisible];
    
    //开启网络监控
     [[AFNetworkReachabilityManager sharedManager] startMonitoring];
    
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application {
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

@end
